package com.itheima.bakery.demos.web.model;

import com.fasterxml.jackson.annotation.JsonProperty;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;

@Entity
@Table(name = "Products")
public class Product {
    @Id
    @Column(name = "productID")
    private Integer id;

    @Column(nullable = false)
    private String name;

    @Column(columnDefinition = "TEXT")
    private String description;

    @Column(nullable = false)
    private BigDecimal price;

    private Double weight;

    @Column(columnDefinition = "TEXT")
    private String ingredients;

    @Column(columnDefinition = "TEXT",name="nutrition_facts")
    private String nutritionFacts;

    private String imageURL;
    private String detailUrl;

    @Column(nullable = false,name="stock_quantity")
    private Integer stockQuantity;

    private Integer categoryID;

    @Column(insertable = false, updatable = false,name="created_date")
    private Timestamp createdDate;

    public Product(){}
    public Product(Integer id, String name, String description, BigDecimal price, Double weight, String ingredients,String nutritionFacts, String imageURL, Integer stockQuantity, Integer categoryID, Timestamp createdDate,String detailUrl) {
        this.id = id;
        this.name = name;
        this.description = description;
        this.price = price;
        this.weight = weight;
        this.ingredients = ingredients;
        this.nutritionFacts = nutritionFacts;
        this.imageURL = imageURL;
        this.stockQuantity = stockQuantity;
        this.categoryID = categoryID;
        this.createdDate = createdDate;
       this.detailUrl=detailUrl;
    }
    // Getters and Setters
    public Integer getProductID() {
        return id;
    }
    public void setProductID(Integer productID) {
        this.id = productID;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public BigDecimal getPrice() {
        return price;
    }
    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    public Double getWeight() {
        return weight;
    }
    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public String getIngredients() {
        return ingredients;
    }
    public void setIngredients(String ingredients) {
        this.ingredients = ingredients;
    }
    public String getNutritionFacts() {
        return nutritionFacts;
    }
    public void setNutritionFacts(String nutritionFacts) {
        this.nutritionFacts = nutritionFacts;
    }
    public String getImageURL() {
        return imageURL;
    }
    public void setImageURL(String imageURL) {
        this.imageURL = imageURL;
    }
    public Integer getStockQuantity() {
        return stockQuantity;
    }
    public void setStockQuantity(Integer stockQuantity) {
        this.stockQuantity = stockQuantity;
    }
    public Integer getCategoryID() {
        return categoryID;
    }
    public void setCategoryID(Integer categoryID) {
        this.categoryID = categoryID;
    }
    public Timestamp getCreatedDate() {
        return createdDate;
    }
    public void setCreatedDate(Timestamp createdDate) {
        this.createdDate = createdDate;
    }
    public String getDetailUrl(){
        return detailUrl;
    }
    public void setDetailUrl(String detailUrl){
        this.detailUrl = detailUrl;}}